package com.usian.service;

import com.github.pagehelper.PageInfo;
import com.usian.common.dto.TrainingDTO;
import com.usian.common.model.training.TrainingMember;
import com.usian.common.untils.Result;
import com.usian.common.vo.TrainingVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @projectName: 2210A-project1
 * @package: com.usian.service
 * @className: TrainingFeignService
 * @author: 莫洪维
 * @email: 1204315800@qq.com
 * @description: TODO
 * @date: 2023/8/23 18:31
 */
@FeignClient("day15Training")
public interface TrainingFeignService {

    /**
     * 根据培训id查询试卷方法
     * @param id
     * @return 试卷集合 Result.data.key -> list
     */
    @RequestMapping(value = "/trainingPaper/findPaper",method = RequestMethod.GET)
    public Result findPaper(@RequestParam("id") Long id);

    /**
     * 根据培训id查询课程方法
     * @param id
     * @return 课程集合 Result.data.key -> list
     */
    @RequestMapping(value = "/trainingCourse/findCourse",method = RequestMethod.GET)
    public Result findCourse(@RequestParam("id") Long id);

    /**
     * 添加中间表方法
     * @param trainingMember
     * @return
     */
    @RequestMapping(value = "/trainingMember/saveTM",method = RequestMethod.POST)
    public Result saveTM(TrainingMember trainingMember);

    /**
     * 根据培训id查询中间表信息
     * @param trainingId
     * @return
     */
    @RequestMapping(value = "/trainingMember/findTM",method = RequestMethod.GET)
    public List<TrainingMember> findTM(@RequestParam("trainingId") Long trainingId);

    /**
     * 根据培训id查询成员数量方法
     * @param trainingId
     * @return
     */
    @RequestMapping(value = "/trainingMember/trainingMemberNum",method = RequestMethod.GET)
    public Integer trainingMemberNum(@RequestParam("trainingId") Long trainingId);

    /**
     * 根据试卷id查询成员数量方法
     * @param paperId
     * @return
     */
    @RequestMapping(value = "/trainingPaper/paperMemberNum",method = RequestMethod.GET)
    public Integer paperMemberNum(@RequestParam("paperId") Long paperId);

    /**
     * 根据培训id查询测验数量方法
     * @param trainingId
     * @return
     */
    @RequestMapping(value = "/trainingPaper/trainingPaperNum",method = RequestMethod.GET)
    public Integer trainingPaperNum(@RequestParam("trainingId") Long trainingId);

    /**
     * 根据培训id查询课程数量方法
     * @param trainingId
     * @return
     */
    @RequestMapping(value = "/trainingCourse/trainingForCourseNum",method = RequestMethod.GET)
    public Integer trainingForCourseNum(@RequestParam("trainingId") Long trainingId);


    /**
     * 查询所有培训方法
     * @param trainingDTO
     * @return
     */
    @RequestMapping(value = "/training/list",method = RequestMethod.GET)
    public PageInfo<TrainingVO> list(@SpringQueryMap TrainingDTO trainingDTO);

    /**
     * 根据成员id查询课程数量方法
     * @param memberId
     * @return
     */
    @RequestMapping(value = "/trainingCourse/toCourseNum",method = RequestMethod.GET)
    public Result toCourseNum(@RequestParam("memberId") Long memberId);

    /**
     * 根据成员id查询订阅课程id集合
     * @param memberId
     * @return
     */
    @RequestMapping(value = "/trainingCourse/toMemberCourse",method = RequestMethod.GET)
    public Result toMemberCourse(@RequestParam("memberId") Long memberId);

    /**
     * 根据成员id查询培训数量
     * @param memberId
     * @return
     */
    @RequestMapping(value = "/trainingMember/countMemberTraining",method = RequestMethod.GET)
    public Result countMemberTraining(@RequestParam("memberId") Long memberId);

    /**
     * 根据课程id查询学习成员数量
     * @param courseId
     * @return
     */
    @RequestMapping(value = "/trainingCourse/toCourseStudyNum",method = RequestMethod.GET)
    public Integer toCourseStudyNum(@RequestParam("courseId") Long courseId);
}
